package com.alphawavesgames.engine.game;

import com.alphawavesgames.engine.rendering.RenderContainer;
import com.alphawavesgames.engine.rendering.SceneRenderer;

/**
 *
 * @author Duncan
 */
public class RenderUpdateThread  extends Thread
{
    private RenderContainer m_renderContainer;
    private boolean m_running;

    //private final ReentrantLock m_threadLock = new ReentrantLock();
    private SceneRenderer m_sceneRenderer;

    public RenderUpdateThread( RenderContainer renderContainer )
    {
        m_renderContainer = renderContainer;
        m_running = true;
        m_sceneRenderer = null;
    }

    public void initialise( SceneRenderer sceneRenderer )
    {
        m_sceneRenderer = sceneRenderer;
    }

    public void stopRunning()
    {
        m_running = false;
    }

    /*
    public void lockThread()
    {
        m_threadLock.lock();
    }

    public void unlockThread()
    {
        m_threadLock.unlock();
    }
*/
    @Override
    public void run()
    {
       /* while( m_running && ( m_renderContainer != null ) )
        {
            //acquire lock on sychronisation object
            //lockThread();
            m_sceneRenderer.beginResourceUpdate();
            try
            {
                //perform the main update and render tasks
                m_renderContainer.update();
            }
            finally
            {
                //release lock on sync object
                //unlockThread();
                m_sceneRenderer.endResourceUpdate();
            }
        }*/
    }

}
